package com.dailyblue.example.spring.aop.xml.advice;

import org.springframework.aop.AfterReturningAdvice;
import org.springframework.aop.MethodBeforeAdvice;

import java.lang.reflect.Method;
import java.util.Arrays;

public class FirstAdvice implements MethodBeforeAdvice, AfterReturningAdvice {
    @Override
    public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable {
        System.out.println("执行了后置通知操作");
        System.out.println("返回结果是：" + returnValue);
        System.out.println("参数是：" + Arrays.toString(args));
    }

    @Override
    public void before(Method method, Object[] args, Object target) throws Throwable {
        System.out.println("执行了前置通知操作");
        System.out.println("参数是：" + Arrays.toString(args));
    }
}
